#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <cjdevice.h>
#include <QTableWidgetItem>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void GetAvailablePorts();
    void SlotsInit();
    void SetItemOfTableWidget();
    void SetContent(int row,int column,QString value);
    void TextEditAppendText(QString);
    bool WriteAddr(int);
    float ReadVoltage(int addr);
    void ReadCjBatteryNumber();
    CJDevice cjdevice;
    QTimer timer;
    QTimer nextTimeTimer;
    int rowNumber=0;
    int startBatteryNumber=1;
    int currentBatteryNumber=1;
    int nextTimeCurrBatNumber=0;
    bool isRunning=false;
    bool nextIsSucces=false;
private:
    Ui::MainWindow *ui;
public slots:
    void FreshDeviceNumber();
    void SetBatteryNumber();
    void OpenPort();
    void Slots_ToShowValueData(AGroupBattery);
    void StartWriteAddr();
    void StopWriteAddr();
    void WriteAdderTimeOut();
    void SingleWriteAddress();
    void ShowOutPutMessage(QByteArray);
    void SendComplete(int adder);

    void StartWriteAdderNextStep();
    void NextTimerTimeOut();
    void StopNextTimeWriteAddr();
    void GoToNextStep();

};
#endif // MAINWINDOW_H
